You are here: Symbol Reference > Dew Namespace > Dew.Math Namespace > Classes > TOpenCLMtxVec Class > TOpenCLMtxVec Methods > PolarToCart Method > TOpenCLMtxVec.PolarToCart Method ([In] TOpenCLMtxVec, [In] TOpenCLMtxVec)
Dew Math for .NET
ContentsIndexHome
PreviousUpNext
TOpenCLMtxVec.PolarToCart Method ([In] TOpenCLMtxVec, [In] TOpenCLMtxVec)

Converts the polar magnitude/phase pairs to cartesian pairs.

Syntax
C#
Visual Basic
public TOpenCLMtxVec PolarToCart([In] TOpenCLMtxVec AmpltVec, [In] TOpenCLMtxVec PhaseVec);

Convert all AmpltVec and PhaseVec elements (combined) from polar to cartesian form. If AmpltVec and PhaseVec size is not the same , an exeption is raised. The results are stored as complex numbers (x=Re, y=Im) in the calling object. Size and TOpenCLBase.ComplexComplexproperties of the calling object are set implicitly to match AmpltVec and PhaseVec objects.

using Dew.Math; using Dew.Math.Units; namespace Dew.Examples() { void Example() { TOpenCLVector a,b,c; clMtxVec.CreateIt(out a, out b, out c); try { a.CopyFromArray( new double[] {1,2,3,4}); // a = [1,2,3, 4] //magnitude b.CopyFromArray( new double[] {1,0,1,-1}); // b = [1,0,1,-1] /phase c.PolarToCart(a,b); // result stored in c = projections to Re and Im axis } finally { clMtxVec.FreeIt(ref a, ref b, ref c); } } }
Copyright (c) 1999-2024 by Dew Research. All rights reserved.
What do you think about this topic? Send feedback!